wishbone-tool 0.7.9

A library and command line program to control a Wishbone bus of an embedded device
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
<html><!-- Created on March, 29  2002 by texi2html 1.64 --><!-- 
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
 
--><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>Debugging with GDB: Remote Protocol</title>

<meta name="description" content="Debugging with GDB: Remote Protocol">
<meta name="keywords" content="Debugging with GDB: Remote Protocol">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.64">

</head>

<body vlink="#800080" text="#000000" link="#0000FF" lang="" bgcolor="#FFFFFF" alink="#FF0000">

<a name="SEC630"></a>
<table cellspacing="1" cellpadding="1" border="0">
<tbody><tr><td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_30.html#SEC629"> &lt; </a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_32.html#SEC631"> &gt; </a>]</td>
<td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_32.html#SEC631"> &lt;&lt; </a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb.html#SEC_Top"> Up </a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_32.html#SEC631"> &gt;&gt; </a>]</td>
<td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb.html#SEC_Top">Top</a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_toc.html#SEC_Contents">Contents</a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_34.html#SEC636">Index</a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_abt.html#SEC_About"> ? </a>]</td>
</tr></tbody></table>
<h1> D. GDB Remote Serial Protocol </h1>
<!--docid::SEC630::-->
<p>

There may be occasions when you need to know something about the
protocol--for example, if there is only one serial port to your target
machine, you might want your program to do something special if it
recognizes a packet meant for GDB.
</p><p>

In the examples below, <samp>`&lt;-'</samp> and <samp>`-&gt;'</samp> are used to indicate
transmitted and received data respectfully.
</p><p>

<a name="IDX1148"></a>
<a name="IDX1149"></a>
<a name="IDX1150"></a>
All GDB commands and responses (other than acknowledgments) are
sent as a <var>packet</var>.  A <var>packet</var> is introduced with the character
<samp>`$'</samp>, the actual <var>packet-data</var>, and the terminating character
<samp>`#'</samp> followed by a two-digit <var>checksum</var>:
</p><p>

<table><tbody><tr><td>&nbsp;</td><td class="smallexample"><font size="-1"></font><pre><font size="-1"><code>$</code><var>packet-data</var><code>#</code><var>checksum</var>
</font></pre></td></tr></tbody></table></p><p>

<a name="IDX1151"></a>
The two-digit <var>checksum</var> is computed as the modulo 256 sum of all
characters between the leading <samp>`$'</samp> and the trailing <samp>`#'</samp> (an
eight bit unsigned checksum).
</p><p>

Implementors should note that prior to GDB 5.0 the protocol
specification also included an optional two-digit <var>sequence-id</var>:
</p><p>

<table><tbody><tr><td>&nbsp;</td><td class="smallexample"><font size="-1"></font><pre><font size="-1"><code>$</code><var>sequence-id</var><code>:</code><var>packet-data</var><code>#</code><var>checksum</var>
</font></pre></td></tr></tbody></table></p><p>

<a name="IDX1152"></a>
That <var>sequence-id</var> was appended to the acknowledgment.  GDB
has never output <var>sequence-id</var>s.  Stubs that handle packets added
since GDB 5.0 must not accept <var>sequence-id</var>.
</p><p>

<a name="IDX1153"></a>
When either the host or the target machine receives a packet, the first
response expected is an acknowledgment: either <samp>`+'</samp> (to indicate
the package was received correctly) or <samp>`-'</samp> (to request
retransmission):
</p><p>

<table><tbody><tr><td>&nbsp;</td><td class="smallexample"><font size="-1"></font><pre><font size="-1">&lt;- <code>$</code><var>packet-data</var><code>#</code><var>checksum</var>
-&gt; <code>+</code>
</font></pre></td></tr></tbody></table></p><p>

The host (GDB) sends <var>command</var>s, and the target (the
debugging stub incorporated in your program) sends a <var>response</var>.  In
the case of step and continue <var>command</var>s, the response is only sent
when the operation has completed (the target has again stopped).
</p><p>

<var>packet-data</var> consists of a sequence of characters with the
exception of <samp>`#'</samp> and <samp>`$'</samp> (see <samp>`X'</samp> packet for additional
exceptions).
</p><p>

Fields within the packet should be separated using <samp>`,'</samp> <samp>`;'</samp> or
<samp>`:'</samp>.  Except where otherwise noted all numbers are represented in
HEX with leading zeros suppressed.
</p><p>

Implementors should note that prior to GDB 5.0, the character
<samp>`:'</samp> could not appear as the third character in a packet (as it
would potentially conflict with the <var>sequence-id</var>).
</p><p>

Response <var>data</var> can be run-length encoded to save space.  A <samp>`*'</samp>
means that the next character is an ASCII encoding giving a repeat count
which stands for that many repetitions of the character preceding the
<samp>`*'</samp>.  The encoding is <code>n+29</code>, yielding a printable character
where <code>n &gt;=3</code> (which is where rle starts to win).  The printable
characters <samp>`$'</samp>, <samp>`#'</samp>, <samp>`+'</samp> and <samp>`-'</samp> or with a numeric
value greater than 126 should not be used.
</p><p>

Some remote systems have used a different run-length encoding mechanism
loosely refered to as the cisco encoding.  Following the <samp>`*'</samp>
character are two hex digits that indicate the size of the packet.
</p><p>

So:
<table><tbody><tr><td>&nbsp;</td><td class="smallexample"><font size="-1"></font><pre><font size="-1">"<code>0* </code>"
</font></pre></td></tr></tbody></table>means the same as "0000".
</p><p>

The error response returned for some packets includes a two character
error number.  That number is not well defined.
</p><p>

For any <var>command</var> not supported by the stub, an empty response
(<samp>`$#00'</samp>) should be returned.  That way it is possible to extend the
protocol.  A newer GDB can tell if a packet is supported based
on that response.
</p><p>

A stub is required to support the <samp>`g'</samp>, <samp>`G'</samp>, <samp>`m'</samp>, <samp>`M'</samp>, 
<samp>`c'</samp>, and <samp>`s'</samp> <var>command</var>s.  All other <var>command</var>s are 
optional.
</p><p>

Below is a complete list of all currently defined <var>command</var>s and
their corresponding response <var>data</var>:
<table>
<tbody><tr><td>Packet</td>
<td> Request
</td><td> Description

</td></tr>
<tr><td>extended mode</td>
<td> <code>!</code>
</td><td>
Enable extended mode.  In extended mode, the remote server is made
persistent.  The <samp>`R'</samp> packet is used to restart the program being
debugged.
</td></tr>
<tr><td></td>
<td> reply <samp>`OK'</samp>
</td><td>
The remote target both supports and has enabled extended mode.

</td></tr>
<tr><td>last signal</td>
<td> <code>?</code>
</td><td>
Indicate the reason the target halted.  The reply is the same as for step
and continue.
</td></tr>
<tr><td></td>
<td> reply
</td><td> see below

</td></tr>
<tr><td>reserved</td>
<td> <code>a</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>set program arguments <strong>(reserved)</strong></td>
<td> <code>A</code><var>arglen</var><code>,</code><var>argnum</var><code>,</code><var>arg</var><code>,...</code>
</td><td>
</td></tr>
<tr><td></td>
<td>
</td><td>
Initialized <samp>`argv[]'</samp> array passed into program. <var>arglen</var>
specifies the number of bytes in the hex encoded byte stream <var>arg</var>.
See <tt>`gdbserver'</tt> for more details.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>

</td></tr>
<tr><td>set baud <strong>(deprecated)</strong></td>
<td> <code>b</code><var>baud</var>
</td><td>
Change the serial line speed to <var>baud</var>.  JTC: <em>When does the
transport layer state change?  When it's received, or after the ACK is
transmitted.  In either case, there are problems if the command or the
acknowledgment packet is dropped.</em> Stan: <em>If people really wanted
to add something like this, and get it working for the first time, they
ought to modify ser-unix.c to send some kind of out-of-band message to a
specially-setup stub and have the switch happen "in between" packets, so
that from remote protocol's point of view, nothing actually
happened.</em>

</td></tr>
<tr><td>set breakpoint <strong>(deprecated)</strong></td>
<td> <code>B</code><var>addr</var>,<var>mode</var>
</td><td>
Set (<var>mode</var> is <samp>`S'</samp>) or clear (<var>mode</var> is <samp>`C'</samp>) a
breakpoint at <var>addr</var>.  <em>This has been replaced by the <samp>`Z'</samp> and
<samp>`z'</samp> packets.</em>

</td></tr>
<tr><td>continue</td>
<td> <code>c</code><var>addr</var>
</td><td>
<var>addr</var> is address to resume. If <var>addr</var> is omitted, resume at
current address.
</td></tr>
<tr><td></td>
<td> reply
</td><td> see below

</td></tr>
<tr><td>continue with signal</td>
<td> <code>C</code><var>sig</var><code>;</code><var>addr</var>
</td><td>
Continue with signal <var>sig</var> (hex signal number).  If
<code>;</code><var>addr</var> is omitted, resume at same address.
</td></tr>
<tr><td></td>
<td> reply
</td><td> see below

</td></tr>
<tr><td>toggle debug <strong>(deprecated)</strong></td>
<td> <code>d</code>
</td><td>
toggle debug flag.

</td></tr>
<tr><td>detach</td>
<td> <code>D</code>
</td><td>
Detach GDB from the remote system.  Sent to the remote target before
GDB disconnects.
</td></tr>
<tr><td></td>
<td> reply <em>no response</em>
</td><td>
GDB does not check for any response after sending this packet.

</td></tr>
<tr><td>reserved</td>
<td> <code>e</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>E</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>f</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>F</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>read registers</td>
<td> <code>g</code>
</td><td> Read general registers.
</td></tr>
<tr><td></td>
<td> reply <var>XX...</var>
</td><td>
Each byte of register data is described by two hex digits.  The bytes
with the register are transmitted in target byte order.  The size of
each register and their position within the <samp>`g'</samp> <var>packet</var> are
determined by the GDB internal macros <var>REGISTER_RAW_SIZE</var> and
<var>REGISTER_NAME</var> macros.  The specification of several standard
<code>g</code> packets is specified below.
</td></tr>
<tr><td></td>
<td> <code>E</code><var>NN</var>
</td><td> for an error.

</td></tr>
<tr><td>write regs</td>
<td> <code>G</code><var>XX...</var>
</td><td>
See <samp>`g'</samp> for a description of the <var>XX...</var> data.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td> for success
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> for an error

</td></tr>
<tr><td>reserved</td>
<td> <code>h</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>set thread</td>
<td> <code>H</code><var>c</var><var>t...</var>
</td><td>
Set thread for subsequent operations (<samp>`m'</samp>, <samp>`M'</samp>, <samp>`g'</samp>,
<samp>`G'</samp>, et.al.).  <var>c</var> = <samp>`c'</samp> for thread used in step and
continue; <var>t...</var> can be -1 for all threads.  <var>c</var> = <samp>`g'</samp> for
thread used in other operations.  If zero, pick a thread, any thread.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td> for success
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> for an error

</td></tr>
<tr><td>cycle step <strong>(draft)</strong></td>
<td> <code>i</code><var>addr</var><code>,</code><var>nnn</var>
</td><td>
Step the remote target by a single clock cycle.  If <code>,</code><var>nnn</var> is
present, cycle step <var>nnn</var> cycles.  If <var>addr</var> is present, cycle
step starting at that address.

</td></tr>
<tr><td>signal then cycle step <strong>(reserved)</strong></td>
<td> <code>I</code>
</td><td>
See <samp>`i'</samp> and <samp>`S'</samp> for likely syntax and semantics.

</td></tr>
<tr><td>reserved</td>
<td> <code>j</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>J</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>kill request</td>
<td> <code>k</code>
</td><td>
FIXME: <em>There is no description of how to operate when a specific
thread context has been selected (i.e. does 'k' kill only that thread?)</em>.

</td></tr>
<tr><td>reserved</td>
<td> <code>l</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>L</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>read memory</td>
<td> <code>m</code><var>addr</var><code>,</code><var>length</var>
</td><td>
Read <var>length</var> bytes of memory starting at address <var>addr</var>.
Neither GDB nor the stub assume that sized memory transfers are assumed
using word alligned accesses. FIXME: <em>A word aligned memory
transfer mechanism is needed.</em>
</td></tr>
<tr><td></td>
<td> reply <var>XX...</var>
</td><td>
<var>XX...</var> is mem contents. Can be fewer bytes than requested if able
to read only part of the data.  Neither GDB nor the stub assume that
sized memory transfers are assumed using word alligned accesses. FIXME:
<em>A word aligned memory transfer mechanism is needed.</em>
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> <var>NN</var> is errno

</td></tr>
<tr><td>write mem</td>
<td> <code>M</code><var>addr</var>,<var>length</var><code>:</code><var>XX...</var>
</td><td>
Write <var>length</var> bytes of memory starting at address <var>addr</var>.
<var>XX...</var> is the data.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td> for success
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td>
for an error (this includes the case where only part of the data was
written).

</td></tr>
<tr><td>reserved</td>
<td> <code>n</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>N</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>o</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>O</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>read reg <strong>(reserved)</strong></td>
<td> <code>p</code><var>n...</var>
</td><td>
See write register.
</td></tr>
<tr><td></td>
<td> return <var>r....</var>
</td><td> The hex encoded value of the register in target byte order.

</td></tr>
<tr><td>write reg</td>
<td> <code>P</code><var>n...</var><code>=</code><var>r...</var>
</td><td>
Write register <var>n...</var> with value <var>r...</var>, which contains two hex
digits for each byte in the register (target byte order).
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td> for success
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> for an error

</td></tr>
<tr><td>general query</td>
<td> <code>q</code><var>query</var>
</td><td>
Request info about <var>query</var>.  In general GDB queries
have a leading upper case letter.  Custom vendor queries should use a
company prefix (in lower case) ex: <samp>`qfsf.var'</samp>.  <var>query</var> may
optionally be followed by a <samp>`,'</samp> or <samp>`;'</samp> separated list.  Stubs
must ensure that they match the full <var>query</var> name.
</td></tr>
<tr><td></td>
<td> reply <code>XX...</code>
</td><td> Hex encoded data from query.  The reply can not be empty.
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> error reply
</td></tr>
<tr><td></td>
<td> reply <samp>`'</samp>
</td><td> Indicating an unrecognized <var>query</var>.

</td></tr>
<tr><td>general set</td>
<td> <code>Q</code><var>var</var><code>=</code><var>val</var>
</td><td>
Set value of <var>var</var> to <var>val</var>.  See <samp>`q'</samp> for a discussing of
naming conventions.

</td></tr>
<tr><td>reset <strong>(deprecated)</strong></td>
<td> <code>r</code>
</td><td>
Reset the entire system.

</td></tr>
<tr><td>remote restart</td>
<td> <code>R</code><var>XX</var>
</td><td>
Restart the program being debugged.  <var>XX</var>, while needed, is ignored.
This packet is only available in extended mode.
</td></tr>
<tr><td></td>
<td>
no reply
</td><td>
The <samp>`R'</samp> packet has no reply.

</td></tr>
<tr><td>step</td>
<td> <code>s</code><var>addr</var>
</td><td>
<var>addr</var> is address to resume.  If <var>addr</var> is omitted, resume at
same address.
</td></tr>
<tr><td></td>
<td> reply
</td><td> see below

</td></tr>
<tr><td>step with signal</td>
<td> <code>S</code><var>sig</var><code>;</code><var>addr</var>
</td><td>
Like <samp>`C'</samp> but step not continue.
</td></tr>
<tr><td></td>
<td> reply
</td><td> see below

</td></tr>
<tr><td>search</td>
<td> <code>t</code><var>addr</var><code>:</code><var>PP</var><code>,</code><var>MM</var>
</td><td>
Search backwards starting at address <var>addr</var> for a match with pattern
<var>PP</var> and mask <var>MM</var>.  <var>PP</var> and <var>MM</var> are 4
bytes.  <var>addr</var> must be at least 3 digits.

</td></tr>
<tr><td>thread alive</td>
<td> <code>T</code><var>XX</var>
</td><td> Find out if the thread XX is alive.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td> thread is still alive
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> thread is dead

</td></tr>
<tr><td>reserved</td>
<td> <code>u</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>U</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>v</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>V</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>w</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>W</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>x</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>write mem (binary)</td>
<td> <code>X</code><var>addr</var><code>,</code><var>length</var><var>:</var><var>XX...</var>
</td><td>
<var>addr</var> is address, <var>length</var> is number of bytes, <var>XX...</var> is
binary data.  The characters <code>$</code>, <code>#</code>, and <code>0x7d</code> are
escaped using <code>0x7d</code>.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td> for success
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> for an error

</td></tr>
<tr><td>reserved</td>
<td> <code>y</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>reserved</td>
<td> <code>Y</code>
</td><td> Reserved for future use

</td></tr>
<tr><td>remove break or watchpoint <strong>(draft)</strong></td>
<td> <code>z</code><var>t</var><code>,</code><var>addr</var><code>,</code><var>length</var>
</td><td>
See <samp>`Z'</samp>.

</td></tr>
<tr><td>insert break or watchpoint <strong>(draft)</strong></td>
<td> <code>Z</code><var>t</var><code>,</code><var>addr</var><code>,</code><var>length</var>
</td><td>
<var>t</var> is type: <samp>`0'</samp> - software breakpoint, <samp>`1'</samp> - hardware
breakpoint, <samp>`2'</samp> - write watchpoint, <samp>`3'</samp> - read watchpoint,
<samp>`4'</samp> - access watchpoint; <var>addr</var> is address; <var>length</var> is in
bytes.  For a software breakpoint, <var>length</var> specifies the size of
the instruction to be patched.  For hardware breakpoints and watchpoints
<var>length</var> specifies the memory region to be monitored.  To avoid
potential problems with duplicate packets, the operations should be
implemented in an idempotent way.
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> for an error
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td> for success
</td></tr>
<tr><td></td>
<td> <samp>`'</samp>
</td><td> If not supported.

</td></tr>
<tr><td>reserved</td>
<td> &lt;other&gt;
</td><td> Reserved for future use

</td></tr></tbody></table>
</p><p>

The <samp>`C'</samp>, <samp>`c'</samp>, <samp>`S'</samp>, <samp>`s'</samp> and <samp>`?'</samp> packets can
receive any of the below as a reply.  In the case of the <samp>`C'</samp>,
<samp>`c'</samp>, <samp>`S'</samp> and <samp>`s'</samp> packets, that reply is only returned
when the target halts.  In the below the exact meaning of <samp>`signal
number'</samp> is poorly defined.  In general one of the UNIX signal numbering
conventions is used.
</p><p>

<table>

<tbody><tr><td><code>S</code><var>AA</var></td>
<td> <var>AA</var> is the signal number

</td></tr>
<tr><td><code>T</code><var>AA</var><var>n...</var><code>:</code><var>r...</var><code>;</code><var>n...</var><code>:</code><var>r...</var><code>;</code><var>n...</var><code>:</code><var>r...</var><code>;</code></td>
<td>
<var>AA</var> = two hex digit signal number; <var>n...</var> = register number
(hex), <var>r...</var>  = target byte ordered register contents, size defined
by <code>REGISTER_RAW_SIZE</code>; <var>n...</var> = <samp>`thread'</samp>, <var>r...</var> =
thread process ID, this is a hex integer; <var>n...</var> = other string not
starting with valid hex digit.  GDB should ignore this
<var>n...</var>, <var>r...</var> pair and go on to the next.  This way we can
extend the protocol.

</td></tr>
<tr><td><code>W</code><var>AA</var></td>
<td>
The process exited, and <var>AA</var> is the exit status.  This is only
applicable for certains sorts of targets.

</td></tr>
<tr><td><code>X</code><var>AA</var></td>
<td>
The process terminated with signal <var>AA</var>.

</td></tr>
<tr><td><code>N</code><var>AA</var><code>;</code><var>t...</var><code>;</code><var>d...</var><code>;</code><var>b...</var> <strong>(obsolete)</strong></td>
<td>
<var>AA</var> = signal number; <var>t...</var> = address of symbol "_start";
<var>d...</var> = base of data section; <var>b...</var> = base of bss section.
<em>Note: only used by Cisco Systems targets.  The difference between
this reply and the "qOffsets" query is that the 'N' packet may arrive
spontaneously whereas the 'qOffsets' is a query initiated by the host
debugger.</em>

</td></tr>
<tr><td><code>O</code><var>XX...</var></td>
<td>
<var>XX...</var> is hex encoding of ASCII data.  This can happen at any time
while the program is running and the debugger should continue to wait
for 'W', 'T', etc.

</td></tr></tbody></table>
</p><p>

The following set and query packets have already been defined.
</p><p>

<table>

<tbody><tr><td>current thread</td>
<td> <code>q</code><code>C</code>
</td><td> Return the current thread id.
</td></tr>
<tr><td></td>
<td> reply <code>QC</code><var>pid</var>
</td><td>
Where <var>pid</var> is a HEX encoded 16 bit process id.
</td></tr>
<tr><td></td>
<td> reply *
</td><td> Any other reply implies the old pid.

</td></tr>
<tr><td>all thread ids</td>
<td> <code>q</code><code>fThreadInfo</code>
</td></tr>
<tr><td></td>
<td> <code>q</code><code>sThreadInfo</code>
</td><td>
Obtain a list of active thread ids from the target (OS).  Since there
may be too many active threads to fit into one reply packet, this query
works iteratively: it may require more than one query/reply sequence to
obtain the entire list of threads.  The first query of the sequence will
be the <code>qf</code><code>ThreadInfo</code> query; subsequent queries in the
sequence will be the <code>qs</code><code>ThreadInfo</code> query.
</td></tr>
<tr><td></td>
<td>
</td><td> NOTE: replaces the <code>qL</code> query (see below).
</td></tr>
<tr><td></td>
<td> reply <code>m</code><var>&lt;id&gt;</var>
</td><td> A single thread id
</td></tr>
<tr><td></td>
<td> reply <code>m</code><var>&lt;id&gt;</var>,<var>&lt;id&gt;...</var>
</td><td> a comma-separated list of thread ids
</td></tr>
<tr><td></td>
<td> reply <code>l</code>
</td><td> (lower case 'el') denotes end of list.
</td></tr>
<tr><td></td>
<td>
</td><td>
In response to each query, the target will reply with a list of one
or more thread ids, in big-endian hex, separated by commas.  GDB will
respond to each reply with a request for more thread ids (using the
<code>qs</code> form of the query), until the target responds with <code>l</code>
(lower-case el, for <code>'last'</code>).

</td></tr>
<tr><td>extra thread info</td>
<td> <code>q</code><code>ThreadExtraInfo</code><code>,</code><var>id</var>
</td><td>
</td></tr>
<tr><td></td>
<td>
</td><td>
Where <var>&lt;id&gt;</var> is a thread-id in big-endian hex.
Obtain a printable string description of a thread's attributes from
the target OS.  This string may contain anything that the target OS
thinks is interesting for GDB to tell the user about the thread.
The string is displayed in GDB's <samp>`info threads'</samp> display.
Some examples of possible thread extra info strings are "Runnable", or
"Blocked on Mutex".
</td></tr>
<tr><td></td>
<td> reply <var>XX...</var>
</td><td>
Where <var>XX...</var> is a hex encoding of ASCII data, comprising the
printable string containing the extra information about the thread's
attributes.

</td></tr>
<tr><td>query <var>LIST</var> or <var>threadLIST</var> <strong>(deprecated)</strong></td>
<td> <code>q</code><code>L</code><var>startflag</var><var>threadcount</var><var>nextthread</var>
</td><td>
</td></tr>
<tr><td></td>
<td>
</td><td>
Obtain thread information from RTOS.  Where: <var>startflag</var> (one hex
digit) is one to indicate the first query and zero to indicate a
subsequent query; <var>threadcount</var> (two hex digits) is the maximum
number of threads the response packet can contain; and <var>nextthread</var>
(eight hex digits), for subsequent queries (<var>startflag</var> is zero), is
returned in the response as <var>argthread</var>.
</td></tr>
<tr><td></td>
<td>
</td><td> NOTE: this query is replaced by the <code>q</code><code>fThreadInfo</code>
query (see above).
</td></tr>
<tr><td></td>
<td> reply <code>q</code><code>M</code><var>count</var><var>done</var><var>argthread</var><var>thread...</var>
</td><td>
</td></tr>
<tr><td></td>
<td>
</td><td>
Where: <var>count</var> (two hex digits) is the number of threads being
returned; <var>done</var> (one hex digit) is zero to indicate more threads
and one indicates no further threads; <var>argthreadid</var> (eight hex
digits) is <var>nextthread</var> from the request packet; <var>thread...</var> is
a sequence of thread IDs from the target.  <var>threadid</var> (eight hex
digits).  See <code>remote.c:parse_threadlist_response()</code>.

</td></tr>
<tr><td>compute CRC of memory block</td>
<td> <code>q</code><code>CRC:</code><var>addr</var><code>,</code><var>length</var>
</td><td>
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td> An error (such as memory fault)
</td></tr>
<tr><td></td>
<td> reply <code>C</code><var>CRC32</var>
</td><td> A 32 bit cyclic redundancy check of the specified memory region.

</td></tr>
<tr><td>query sect offs</td>
<td> <code>q</code><code>Offsets</code>
</td><td>
Get section offsets that the target used when re-locating the downloaded
image.  <em>Note: while a <code>Bss</code> offset is included in the
response, GDB ignores this and instead applies the <code>Data</code>
offset to the <code>Bss</code> section.</em>
</td></tr>
<tr><td></td>
<td> reply <code>Text=</code><var>xxx</var><code>;Data=</code><var>yyy</var><code>;Bss=</code><var>zzz</var>

</td></tr>
<tr><td>thread info request</td>
<td> <code>q</code><code>P</code><var>mode</var><var>threadid</var>
</td><td>
</td></tr>
<tr><td></td>
<td>
</td><td>
Returns information on <var>threadid</var>.  Where: <var>mode</var> is a hex
encoded 32 bit mode; <var>threadid</var> is a hex encoded 64 bit thread ID.
</td></tr>
<tr><td></td>
<td> reply *
</td><td>
See <code>remote.c:remote_unpack_thread_info_response()</code>.

</td></tr>
<tr><td>remote command</td>
<td> <code>q</code><code>Rcmd,</code><var>COMMAND</var>
</td><td>
</td></tr>
<tr><td></td>
<td>
</td><td>
<var>COMMAND</var> (hex encoded) is passed to the local interpreter for
execution.  Invalid commands should be reported using the output string.
Before the final result packet, the target may also respond with a
number of intermediate <code>O</code><var>OUTPUT</var> console output
packets.  <em>Implementors should note that providing access to a
stubs's interpreter may have security implications</em>.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td>
A command response with no output.
</td></tr>
<tr><td></td>
<td> reply <var>OUTPUT</var>
</td><td>
A command response with the hex encoded output string <var>OUTPUT</var>.
</td></tr>
<tr><td></td>
<td> reply <code>E</code><var>NN</var>
</td><td>
Indicate a badly formed request.

</td></tr>
<tr><td></td>
<td> reply <samp>`'</samp>
</td><td>
When <samp>`q'</samp><samp>`Rcmd'</samp> is not recognized.

</td></tr>
<tr><td>symbol lookup</td>
<td> <code>qSymbol::</code>
</td><td>
Notify the target that GDB is prepared to serve symbol lookup
requests.  Accept requests from the target for the values of symbols.
</td></tr>
<tr><td></td>
<td>
</td><td>
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td>
The target does not need to look up any (more) symbols.
</td></tr>
<tr><td></td>
<td> reply <code>qSymbol:</code><var>sym_name</var>
</td><td>
The target requests the value of symbol <var>sym_name</var> (hex encoded).  
GDB may provide the value by using the 
<code>qSymbol:</code><var>sym_value</var>:<var>sym_name</var>
message, described below.

</td></tr>
<tr><td>symbol value</td>
<td> <code>qSymbol:</code><var>sym_value</var>:<var>sym_name</var>
</td><td>
Set the value of SYM_NAME to SYM_VALUE.
</td></tr>
<tr><td></td>
<td>
</td><td>
<var>sym_name</var> (hex encoded) is the name of a symbol whose value
the target has previously requested.
</td></tr>
<tr><td></td>
<td>
</td><td>
<var>sym_value</var> (hex) is the value for symbol <var>sym_name</var>.
If GDB cannot supply a value for <var>sym_name</var>, then this
field will be empty.
</td></tr>
<tr><td></td>
<td> reply <code>OK</code>
</td><td>
The target does not need to look up any (more) symbols.
</td></tr>
<tr><td></td>
<td> reply <code>qSymbol:</code><var>sym_name</var>
</td><td>
The target requests the value of a new symbol <var>sym_name</var> (hex encoded).
GDB will continue to supply the values of symbols (if available),
until the target ceases to request them.

</td></tr></tbody></table>
</p><p>

The following <samp>`g'</samp>/<samp>`G'</samp> packets have previously been defined.
In the below, some thirty-two bit registers are transferred as sixty-four
bits.  Those registers should be zero/sign extended (which?) to fill the
space allocated.  Register bytes are transfered in target byte order.
The two nibbles within a register byte are transfered most-significant -
least-significant.
</p><p>

<table>

<tbody><tr><td>MIPS32</td>
<td>
All registers are transfered as thirty-two bit quantities in the order:
32 general-purpose; sr; lo; hi; bad; cause; pc; 32 floating-point
registers; fsr; fir; fp.

</td></tr>
<tr><td>MIPS64</td>
<td>
All registers are transfered as sixty-four bit quantities (including
thirty-two bit registers such as <code>sr</code>).  The ordering is the same
as <code>MIPS32</code>.

</td></tr></tbody></table>
</p><p>

Example sequence of a target being re-started.  Notice how the restart
does not get any direct output:
</p><p>

<table><tbody><tr><td>&nbsp;</td><td class="smallexample"><font size="-1"></font><pre><font size="-1">&lt;- <code>R00</code>
-&gt; <code>+</code>
<em>target restarts</em>
&lt;- <code>?</code>
-&gt; <code>+</code>
-&gt; <code>T001:1234123412341234</code>
&lt;- <code>+</code>
</font></pre></td></tr></tbody></table></p><p>

Example sequence of a target being stepped by a single instruction:
</p><p>

<table><tbody><tr><td>&nbsp;</td><td class="smallexample"><font size="-1"></font><pre><font size="-1">&lt;- <code>G1445...</code>
-&gt; <code>+</code>
&lt;- <code>s</code>
-&gt; <code>+</code>
<em>time passes</em>
-&gt; <code>T001:1234123412341234</code>
&lt;- <code>+</code>
&lt;- <code>g</code>
-&gt; <code>+</code>
-&gt; <code>1455...</code>
&lt;- <code>+</code>
</font></pre></td></tr></tbody></table></p><p>

<a name="Copying"></a>
</p><hr size="6">
<table cellspacing="1" cellpadding="1" border="0">
<tbody><tr><td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_32.html#SEC631"> &lt;&lt; </a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_32.html#SEC631"> &gt;&gt; </a>]</td>
<td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT"> &nbsp; </td><td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb.html#SEC_Top">Top</a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_toc.html#SEC_Contents">Contents</a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_34.html#SEC636">Index</a>]</td>
<td valign="MIDDLE" align="LEFT">[<a href="http://davis.lbl.gov/Manuals/GDB/gdb_abt.html#SEC_About"> ? </a>]</td>
</tr></tbody></table>
<br>  
<font size="-1">

<address>

<p>Please send FSF &amp; GNU inquiries &amp; questions to <a href="mailto:gnu@gnu.org">gnu@gnu.org</a>.  There are also <a href="http://www.gnu.org/home.html#ContactInfo">other ways to
contact</a> the FSF.</p>

<p>These pages are maintained by <a href="http://www.gnu.org/software/gdb/">the GDB developers</a>.</p>

<p>Copyright Free Software Foundation, Inc., 59 Temple Place - Suite
330, Boston, MA 02111, USA.</p>

<p>Verbatim copying and distribution of this entire article is
permitted in any medium, provided this notice is preserved.</p>

</address>

This document was generated
by <i>GDB Administrator</i> on <i>March, 29  2002</i>
using <a href="http://www.mathematik.uni-kl.de/~obachman/Texi2html"><i>texi2html</i></a>



</font></body></html>